home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DRIVES.SWG / 0094_Checking Drive Ready.pas < prev    next >
Pascal/Delphi Source File  |  1995-02-28  |  774b  |  50 lines

  1.  
  2. {
  3. checking for drive ready?
  4.  
  5. Here's something that I fiddled arround. It is still noisy but
  6. thought you may want to see it.
  7. }
  8.  
  9. uses
  10.  Crt, Dos;
  11.  
  12. function DriveReady(Drive : Byte) : Boolean; assembler;
  13. { a=0, b=1, etc.  Shouldn't work at all on hard drives !! }
  14. var
  15.  Buffer : array[1..512] of Byte;
  16.  N      : Byte;
  17.  
  18. asm
  19.  mov [N],3         { retry 3 times }
  20. @10:
  21.  mov ax,$0401
  22.  mov cx,$0001
  23.  mov dh,$00
  24.  mov dl,[Drive]
  25.  push ss
  26.  pop es
  27.  lea bx,[Buffer]
  28.  int $13
  29.  mov al,FALSE
  30.  jnc @20
  31.  dec [N]
  32.  jnz @10
  33.  jmp @30
  34. @20:
  35.  or ah,ah
  36.  jnz @30
  37.  mov al,TRUE
  38. @30:
  39. end;
  40.  
  41. begin
  42.  ClrScr;
  43.  repeat
  44.   writeln(^G'Drive Ready = ', DriveReady(0));
  45.   Mem[$40:$40]:=255;
  46.   Delay(2000);
  47.  until (KeyPressed);
  48.  Mem[$40:$40]:=1;  { shut motors }
  49. end.
  50.